<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>员工修改信息审核</title>
	<link rel="stylesheet" href="/Public/User/pc/css/bootstrap.min.css">
	<script src="/Public/User/pc/js/jquery-1.8.3.min.js"></script>
	<style>
		.container {
			padding-left: 10%;
			margin-right: auto;
			margin-left: auto;
		}
		.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th {
			padding: 8px;
			line-height: 1.42857143;
			vertical-align: top;
			border-top: 0px solid #ddd;

		}
	</style>
</head>
<body>
<div id="nav">
    <nav class="navbar navbar-default ">
	<div class="container">
		<div class="btn-group" role="group" >
			<?php if(array_key_exists('insert',$list)){ $insert_display='style="display:block"'; }else{ $insert_display='style="display:none"'; } ?>
			<button type="button" id="btn1" <?php echo $insert_display;?> class="btn btn-success">新增的数据</button>

			<?php if(array_key_exists('update',$list)){ $update_display='style="display:block"'; }else{ $update_display='style="display:none"'; } ?>
			<button type="button" id="btn2" <?php echo $update_display;?>  class="btn btn-info">更改的数据</button>
			<?php if(array_key_exists('delete',$list)){ $delete_display='style="display:block"'; }else{ $delete_display='style="display:none"'; } ?>
			<button type="button" id="btn3" <?php echo $delete_display;?>  class="btn bbtn-danger">删除的数据</button>
		</div>
	</div>
</nav>
</div>
<div id="insert">
    <?php foreach($list['insert'] as $k=>$v){ if($k == 0){ $display='style="display:black"'; }else{ $display='style="display:none"'; } $count = count($list['insert']); $div = ''; for($i=1;$i<=$count;$i++){ $div .= "<button class='but_inter' onclick='inter(this);'>".$i."</button>"; } ?>
    <div class="inter" <?php echo $display; ?> page="<?php echo ($k+1); ?>">
        <div class="page" style="text-align:center;margin-bottom:10px;"><?php echo $div;?></div>
        <form class="form-horizontal container"  id="form1">
            <?php foreach($v['info'] as $k1=>$v1){ ?>
                <div class="form-group">
                    <label  class="col-sm-2 control-label"><?php echo $v1['caption'];?>:</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" value="<?php echo $v1['value'];?>" >
                    </div>
                </div>
            <?php } ?>
        </form>
    </div>
    <?php } ?>
</div>

<div id="update">
    <?php foreach($list['update'] as $k=>$v){ if($k == 0){ $display='style="display:black"'; }else{ $display='style="display:none"'; } $count = count($list['update']); $div = ''; for($i=1;$i<=$count;$i++){ $div .= "<button class='but_upd' onclick='upd(this);'>".$i."</button>"; } ?>
    <div class="upd" <?php echo $display; ?> page="<?php echo ($k+1); ?>">
        <div class="page" style="text-align:center;margin-bottom:10px;"><?php echo $div;?></div>
        <form class="form-horizontal container" id="form2">
        <table class="table"  >
            <?php foreach($v['info'] as $k1=>$v1){?>
            <tr>
                <td >
                    <div class="form-group">
                        <label  class="col-sm-3 control-label"><?php echo $v1['caption'];?>:</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" value="<?php echo $v1['value']; ?>" >
                        </div>
                    </div>
                </td>
                <td >
                    <?php if($v1['change_type'] == 1){ ?>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">更改前:</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" value="<?php echo $v1['oldvalue']; ?>"  >
                        </div>
                    </div>
                    <?php } ?>
                </td>
            </tr>
            <?php } ?>
        </table>
        </form>
    </div>
    <?php } ?>
</div>

<div id="delete">
    <?php foreach($list['delete'] as $k=>$v){ if($k == 0){ $display='style="display:black"'; }else{ $display='style="display:none"'; } $count = count($list['update']); $div = ''; for($i=1;$i<=$count;$i++){ $div .= "<button class='but_del' onclick='del(this);'>".$i."</button>"; }?>
    <div class="del" <?php echo $display; ?> page="<?php echo ($k+1); ?>">
        <div class="page" style="text-align:center;margin-bottom:10px;"><?php echo $div;?></div>
        <form class="form-horizontal container" id="form3">
        <?php foreach($v['info'] as $k1=>$v1){ ?>
            <div class="form-group">
                <label  class="col-sm-2 control-label"><?php echo $v1['caption'];?>:</label>
                <div class="col-sm-6">
                    <input type="text" class="form-control" value="<?php echo $v1['value'];?>" >
                </div>
            </div>
        <?php } ?>
        </form>
    </div>
    <?php } ?>
</div>
</body>
<script>
	$(function(){
		$('#update').hide();
		$('#delete').hide();
        var btn1 = $('#btn1').css('display');
        var btn2 = $('#btn2').css('display');
        var btn3 = $('#btn3').css('display');
        if(btn1 == 'none'){
            $('#update').show();
        }else if(btn2 == 'none'){
            $('#delete').show();
        }

		$('#btn1').click(function(){
			$('#insert').show();
			$('#update').hide();
			$('#delete').hide();
		});

		$('#btn2').click(function(){
			$('#insert').hide();
			$('#update').show();
			$('#delete').hide();
		});

		$('#btn3').click(function(){
			$('#insert').hide();
			$('#update').hide();
			$('#delete').show();
		});
	});

    function inter(a){
        var val = $(a).text();
        $('.but_inter').css('color','black');
        $(a).css('color','red');
        $('.inter').each(function(k,v){
            var page = $(this).attr('page');
            if(val == page){
                $('.inter').hide();
                $(this).show();
            }
        })
    }
    function upd(a){
        var val = $(a).text();
        $('.upd').each(function(k,v){
            var page = $(this).attr('page');
            if(val == page){
                $('.upd').hide();
                $(this).show();

            }
        })
    }
    function del(a){
        var val = $(a).text();
        $('.del').each(function(k,v){
            var page = $(this).attr('page');
            if(val == page){
                $('.del').hide();
                $(this).show();

            }
        })
    }
</script>
</html>